Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add very verbose option #623

Merged
merged 4 commits into from
Jun 19, 2022
Merged

Conversation

jcamiel
Copy link
Collaborator

@jcamiel jcamiel commented Jun 17, 2022

When very-verbose is used, the HTTP body response is logged.

For instance, this Hurl file:

GET https://google.fr
GET https://www.google.fr

Then:

$ hurl --very-verbose --no-output google.hurl
* Options:
*     fail fast: true
*     insecure: false
*     follow redirect: false
*     max redirect: 50
* ------------------------------------------------------------------------------
* Executing entry 1
*
* Cookie store:
*
* Request:
* GET https://google.fr
*
* Request can be run with the following curl command:
* curl 'https://google.fr'
*
> GET / HTTP/2
> Host: google.fr
> accept: */*
> user-agent: hurl/1.7.0-snapshot
>
< HTTP/2 301
< location: https://www.google.fr/
< content-type: text/html; charset=UTF-8
< date: Fri, 17 Jun 2022 16:33:29 GMT
< expires: Fri, 17 Jun 2022 16:33:29 GMT
< cache-control: private, max-age=2592000
< server: gws
< content-length: 219
< x-xss-protection: 0
< x-frame-options: SAMEORIGIN
< set-cookie: CONSENT=PENDING+410; expires=Sun, 16-Jun-2024 16:33:29 GMT; path=/; domain=.google.fr; Secure
< p3p: CP="This is not a P3P policy! See g.co/p3phelp for more info."
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
<
* Response:
* <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
* <TITLE>301 Moved</TITLE></HEAD><BODY>
* <H1>301 Moved</H1>
* The document has moved
* <A HREF="https://www.google.fr/">here</A>.
* </BODY></HTML>
*
*
* ------------------------------------------------------------------------------
* Executing entry 2
*
* Cookie store:
* .google.fr	TRUE	/	TRUE	1718555609	CONSENT	PENDING+410
*
* Request:
* GET https://www.google.fr
*
* Request can be run with the following curl command:
* curl 'https://www.google.fr' --cookie 'CONSENT=PENDING+410'
*
> GET / HTTP/2
> Host: www.google.fr
> accept: */*
> cookie: CONSENT=PENDING+410
> user-agent: hurl/1.7.0-snapshot
>
< HTTP/2 302
< location: https://consent.google.fr/ml?continue=https://www.google.fr/&gl=FR&m=0&pc=shp&uxe=eomts&hl=fr&src=1
< cache-control: private
< content-type: text/html; charset=UTF-8
< p3p: CP="This is not a P3P policy! See g.co/p3phelp for more info."
< date: Fri, 17 Jun 2022 16:33:30 GMT
< server: gws
< content-length: 320
< x-xss-protection: 0
< x-frame-options: SAMEORIGIN
< set-cookie: AEC=AakniGNnBsOhc1n2_fQYHcgP-06I1JW2Xd8O06ld4Kj63T4F5OEgBQ6OM40; expires=Wed, 14-Dec-2022 16:33:30 GMT; path=/; domain=.google.fr; Secure; HttpOnly; SameSite=lax
< set-cookie: __Secure-ENID=5.SE=FkdNVgpVUXvNRdod5VAqb2rTYFo87Kqig-lSJwLl1wxHHwyRDbFaruKm3Ud-bZ14F6s-zB2xL5T2w8BUfLpNnMXu9xpdhEcZcGb55i6-zmHBB-gC1NWiicj7n0uYfFZfLPgl4tCSxpkf4Vx4jBtEBfMQKOyRuNGHxgUHL7PhvJM; expires=Tue, 18-Jul-2023 08:51:48 GMT; path=/; domain=.google.fr; Secure; HttpOnly; SameSite=lax
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
<
* Response:
* <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
* <TITLE>302 Moved</TITLE></HEAD><BODY>
* <H1>302 Moved</H1>
* The document has moved
* <A HREF="https://consent.google.fr/ml?continue=https://www.google.fr/&amp;gl=FR&amp;m=0&amp;pc=shp&amp;uxe=eomts&amp;hl=fr&amp;src=1">here</A>.
* </BODY></HTML>
*
*

With a binary response, we print a slice of the bytes response:

$ echo 'GET https://upload.wikimedia.org/wikipedia/commons/0/0b/Cat_poster_1.jpg' | hurl --very-verbose --no-output
* Options:
*     fail fast: true
*     insecure: false
*     follow redirect: true
*     max redirect: 50
* ------------------------------------------------------------------------------
* Executing entry 1
*
* Cookie store:
*
* Request:
* GET https://upload.wikimedia.org/wikipedia/commons/0/0b/Cat_poster_1.jpg
*
* Request can be run with the following curl command:
* curl 'https://upload.wikimedia.org/wikipedia/commons/0/0b/Cat_poster_1.jpg' -L
*
> GET /wikipedia/commons/0/0b/Cat_poster_1.jpg HTTP/2
> Host: upload.wikimedia.org
> accept: */*
> user-agent: hurl/1.7.0-snapshot
>
< HTTP/2 200
< date: Fri, 17 Jun 2022 10:39:09 GMT
< content-type: image/jpeg
< content-length: 11423554
< x-object-meta-sha1base36: 9kwnvtjql4m0nfnxlmc3dg05hf5kw37
< last-modified: Fri, 04 Oct 2013 03:44:09 GMT
< accept-ranges: bytes
< etag: c0baab607a97839c9a328b4310713307
< server: ATS/8.0.8
< age: 22227
< x-cache: cp6006 hit, cp6003 pass
< x-cache-status: hit-local
< server-timing: cache;desc="hit-local", host;desc="cp6003"
< strict-transport-security: max-age=106384710; includeSubDomains; preload
< report-to: { "group": "wm_nel", "max_age": 86400, "endpoints": [{ "url": "https://intake-logging.wikimedia.org/v1/events?stream=w3c.reportingapi.network_error&schema_uri=/w3c/reportingapi/network_error/1.0.0" }] }
< nel: { "report_to": "wm_nel", "max_age": 86400, "failure_fraction": 0.05, "success_fraction": 0.0}
< accept-ch: Sec-CH-UA-Arch,Sec-CH-UA-Bitness,Sec-CH-UA-Full-Version-List,Sec-CH-UA-Model,Sec-CH-UA-Platform-Version
< permissions-policy: interest-cohort=(),ch-ua-arch=(self "intake-analytics.wikimedia.org"),ch-ua-bitness=(self "intake-analytics.wikimedia.org"),ch-ua-full-version-list=(self "intake-analytics.wikimedia.org"),ch-ua-model=(self "intake-analytics.wikimedia.org"),ch-ua-platform-version=(self "intake-analytics.wikimedia.org")
< x-client-ip: 80.12.66.161
< access-control-allow-origin: *
< access-control-expose-headers: Age, Date, Content-Length, Content-Range, X-Content-Duration, X-Cache
< timing-allow-origin: *
<
* Response:
* Bytes <ffd8ffe000104a46494600010101009600960000ffdb004300010101010101010101010101010101010101010101010101010101010101010101010101010101...>
*

There is no integration test for this PR as testing stderr in verbose more has a lot of variances.

@jcamiel jcamiel marked this pull request as draft June 17, 2022 16:53
@jcamiel jcamiel force-pushed the feature/add-very-verbose-option branch from d6c6327 to 1b08d91 Compare June 17, 2022 16:58
@jcamiel jcamiel marked this pull request as ready for review June 17, 2022 18:09
@jcamiel jcamiel force-pushed the feature/add-very-verbose-option branch from 1b08d91 to 1e88ebc Compare June 17, 2022 19:23
@jcamiel jcamiel force-pushed the feature/add-very-verbose-option branch from 1e88ebc to bbc867f Compare June 17, 2022 19:34
@fabricereix fabricereix merged commit 1c81471 into master Jun 19, 2022
@fabricereix fabricereix deleted the feature/add-very-verbose-option branch June 19, 2022 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

how can veiw log for all reposone on output Add option --very-verbose
2 participants